import 'package:flutter/material.dart';
import 'package:flutter_music/themes/dark_mode.dart';
import 'package:flutter_music/themes/light_mode.dart';

class ThemeProvider extends ChangeNotifier {
  /// 默认主题
  ThemeData _themeMode = lightMode;

  /// 获取当前主题
  ThemeData get currentThemeMode => _themeMode;

  /// 设置当前主题
  set setThemeData(ThemeData themeData) {
    _themeMode = themeData;

    // 更新通知
    notifyListeners();
  }

  /// 是否为dark theme
  bool get isDarkMode => _themeMode == darkMode;

  /// 切换主题
  void toggleTheme() {
    if (isDarkMode) {
      setThemeData = lightMode;
    } else {
      setThemeData = darkMode;
    }
  }
}
